import 'package:flutter_deer/util/print/data/print_format_des.dart';

abstract class IPrintBaseEngine {
  Future<void> init({
    required Map<String, dynamic> config,
    required Function(dynamic) onError,
    required Function() onComplete,
  });

  Future<void> executePrint(List<BasePrintBean> printBeans);

  // 获取打印机状态
  Future<String> getStatus();

  // 打印测试
  Future<void> testPrint() async {
    final printBeanList = <BasePrintBean>[];
    printBeanList.add(TextPrintBean(
        alignment: BasePrintBean.CENTER, text: '检查下打印字体是否清晰检查下打印字体是否清晰检查下打印字体是否清晰检查下打印字体是否清晰', textSize: BasePrintBean.TEXT_SIZE_SMALL, isBold: false, isUnderLine: false));
    printBeanList
        .add(TextPrintBean(alignment: BasePrintBean.LEFT, text: '--------------------------------', textSize: BasePrintBean.TEXT_SIZE_MID, isBold: false, isUnderLine: false));
    printBeanList
        .add(TextPrintBean(alignment: BasePrintBean.LEFT, text: '------------------------------ -', textSize: BasePrintBean.TEXT_SIZE_MID, isBold: false, isUnderLine: false));
    printBeanList
        .add(TextPrintBean(alignment: BasePrintBean.LEFT, text: '123456789.qwer.qwer.qwer.1234.1234.', textSize: BasePrintBean.TEXT_SIZE_MID, isBold: false, isUnderLine: false));
    printBeanList
        .add(TextPrintBean(alignment: BasePrintBean.LEFT, text: '检查下打印字体是否清晰检查下打印 字体是否清晰检查下打印字体是否清晰。', textSize: BasePrintBean.TEXT_SIZE_MID, isBold: true, isUnderLine: true));
    printBeanList.add(TextPrintBean(alignment: BasePrintBean.LEFT, text: '-------------------------', textSize: BasePrintBean.TEXT_SIZE_BIG, isBold: false, isUnderLine: false));
    printBeanList.add(ColumnsTextPrintBean(colsTextArr: ['宝贝名称', '单价', '数量', '价格'], receiptStyle: 'style.configKey'));
    printBeanList.add(ColumnsTextPrintBean(colsTextArr: [
      '01*蜜汁糖藕蜜汁蜜汁',
      '1180',
      '1',
      '1180',
    ], receiptStyle: 'style.configKey'));
    printBeanList.add(ColumnsTextPrintBean(colsTextArr: [
      '02*本帮酱鸭',
      '1180',
      '1',
      '1180',
    ], receiptStyle: 'style.STORE_ORDER'));
    printBeanList.add(ColumnsTextPrintBean(colsTextArr: ['title1', 'title2', 'title3'], receiptStyle: 'style.configKey'));
    printBeanList.add(ColumnsTextPrintBean(colsTextArr: ['q', 'w', 'e'], receiptStyle: 'style.STORE_ORDER'));
    printBeanList.add(ColumnsTextPrintBean(colsTextArr: ['qweqwe', 'qweqwe', 'qweqwe'], receiptStyle: 'style.STORE_ORDER'));
    printBeanList.add(ColumnsTextPrintBean(colsTextArr: ['qweqwe', 'qweqweqwe'], receiptStyle: 'style.'));
    printBeanList.add(TextPrintBean(alignment: BasePrintBean.CENTER, text: '测试打印', textSize: BasePrintBean.TEXT_SIZE_MID, isBold: false, isUnderLine: false));
    printBeanList.add(TextPrintBean(alignment: BasePrintBean.LEFT, text: '检查下打印字体是否清晰。', textSize: BasePrintBean.TEXT_SIZE_BIG, isBold: true, isUnderLine: true));
    printBeanList.add(BlankLinePrintBean(alignment: BasePrintBean.LEFT, blankLineCount: 2));
    printBeanList.add(DashLinePrintBean(alignment: BasePrintBean.LEFT));
    printBeanList.add(CodePrintBean(codeData: '12345678901234567890', codeType: 0));
    executePrint(printBeanList); // 这行代码需要根据实际实现来调用
  }
}
